package com.hui.dao.impl;

import com.hui.bean.UserBean;
import com.hui.dao.IUserDao;
import com.hui.util.DBUtils;
import org.apache.ibatis.session.SqlSession;

import java.sql.SQLException;
import java.util.List;

/**
 * 系统用户dao层实现类
 *
 */
public class UserDaoImpl implements IUserDao {
    @Override
    public UserBean userLogin(String username, String password) throws SQLException {
        SqlSession session = DBUtils.getSqlSession();
        IUserDao mapper = session.getMapper(IUserDao.class);
        UserBean userBean = mapper.userLogin(username, password);
        session.close();
        return userBean;
    }

    @Override
    public void insertManyUser(List<UserBean> userBeans) {
        SqlSession session = DBUtils.getSqlSession();
        IUserDao mapper = session.getMapper(IUserDao.class);
       mapper.insertManyUser(userBeans);
        session.commit();
        session.close();
    }
}
